package com.xywl.escort.utils;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;

import com.meituan.android.walle.WalleChannelReader;

/**
 * Created by dell on 2017/6/26.
 */

public class TelephonyUtil {

    public static String getOsType() {
        return "3";
    }

    /**
     * 获取应用版本号
     *
     * @param context
     * @return
     */
    public static PackageInfo getAppVersionCode(Context context) {
        PackageManager pm = context.getPackageManager();
        PackageInfo pi = null;
        try {
            pi = pm.getPackageInfo(context.getPackageName(), 0);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        return pi;
    }

    /**
     * 获取渠道编号
     *
     * @return
     */
    public static String getChannelId(Context context) {
        String channel = WalleChannelReader.getChannel(context);
        if (TextUtils.isEmpty(channel)) {
            channel = "xy";
        }
        return channel;
    }

}
